<template>
	<view class="news-detail-page" v-if="detail.id">
		<view class="title">
			<text>{{detail.title}}</text>
		</view>

		<view class="sub-title">
			<text>{{detail.subtitle}}</text>
		</view>
		
		<image :src="detail.cover" mode="aspectFill"></image>
		
		<view class="content">
			<u-parse :html="detail.content"></u-parse>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail: {}
			};
		},
		onLoad({ id, title }) {
			uni.setNavigationBarTitle({ title })
			this.getDetail(id)
		},
		methods: {
			getDetail(id) {
				uni.showLoading({
					title: '加载中...',
					mask: true
				})
				this.$u.post('/informationdetail', { information_id: id }).then(res => {
					this.detail = res
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.news-detail-page {
		padding: 0 30rpx;
		padding-top: 10rpx;
		background-color: white;
		min-height: 100vh;

		.title {
			font-size: 32rpx;
			font-weight: bold;
			line-height: 44rpx;
			color: #131415;
		}
		
		.sub-title {
			margin-top: 20rpx;
			font-size: 32rpx;
			font-weight: 400;
			line-height: 44rpx;
			color: #999999;
		}
		
		image {
			width: 690rpx;
			height: 388rpx;
			margin-top: 30rpx;
		}
		
		.content {
			margin-top: 30;
			font-size: 32rpx;
			font-weight: 400;
			line-height: 52rpx;
			color: #999999;
		}

	}
</style>
